package com.evo.chat.common.utils;


import com.evo.chat.common.Result;
import com.evo.chat.common.ResultEnum;

public class ResultUtil {

    public static Result success (Object o) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        result.setData(o);
        return result;
    }

    public static Result success () {
        return success(null);
    }

    public static Result error (Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

    public static Result error (ResultEnum resultEnum) {
        return error(resultEnum.getCode(), resultEnum.getMsg());
    }

}
